package com.android.lovely.room

import androidx.room.TypeConverter
import com.android.lovely.data.CardItem
import com.kotlin.extensions.json.JsonExt.fromJsonByType
import com.kotlin.extensions.json.JsonExt.toJsonByType

class CardConverter {
    @TypeConverter
    fun revertTag(content: String): List<CardItem> {
        return content.fromJsonByType<List<CardItem>>() ?: mutableListOf()
    }

    @TypeConverter
    fun converterContent(value: List<CardItem>): String {
        return value.toJsonByType()
    }
}